package com.ubxtech.core.enums;

/**
 * 浏览器操作系统,用于移动端和pc端区分
 * @author Victor.Xiao
 * @since 2023-12-25 15:39
 **/
public enum UserAgentSystemEnum {

    /** */
    ANDROID("android操作系统", 1),
    /** */
    IPHONE("苹果手机操作系统", 2),

    /** windows和其他,也代表是pc客户端,MAC也算pc */
    PC("pc客户端", 9);


    UserAgentSystemEnum(String name, Integer code) {
        this.code = code;
        this.name = name;
    }

    private String name;
    private int code;

    public String getName() {
        return name;
    }

    public int getCode() {
        return code;
    }

    public static UserAgentSystemEnum parse(int code) {
        for (UserAgentSystemEnum type : UserAgentSystemEnum.values()) {
            if (code == type.getCode()) {
                return type;
            }
        }
        return UserAgentSystemEnum.PC;
    }
}
